﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using Entity;

namespace BIZ
{
    public class ProductBIZ
    {
        ProductDAL DAL = new ProductDAL();

        //-----------------ProductSearchById--------------------------
        public List<objProduct> ProductSearchById(int id)
        {
            try
            {
                List<objProduct> lst = new List<objProduct>();
                lst = DAL.ProductSearchById(id);

                return lst;
            }
            catch (Exception)
            {
                throw;
            }
        }

        //-----------------ProductSearchById_l1--------------------------
        public List<objProduct> ProductSearchById_l1(int id_l1)
        {
            try
            {
                List<objProduct> lst = new List<objProduct>();
                lst = DAL.ProductSearchById(id_l1);

                return lst;
            }
            catch (Exception)
            {
                throw;
            }
        }

        //-----------------ProductSearchById_l2--------------------------
        public List<objProduct> ProductSearchById_l2(int id_l2)
        {
            try
            {
                List<objProduct> lst = new List<objProduct>();
                lst = DAL.ProductSearchById(id_l2);

                return lst;
            }
            catch (Exception)
            {
                throw;
            }
        }

        //-----------------ProductSearchById_l3--------------------------
        public List<objProduct> ProductSearchById_l3(int id_l3)
        {
            try
            {
                List<objProduct> lst = new List<objProduct>();
                lst = DAL.ProductSearchById(id_l3);

                return lst;
            }
            catch (Exception)
            {
                throw;
            }
        }

        //-----------------ProductInsert--------------------------
        public int ProductInsert(int id_l1, int id_l2, int id_l3,
                                int position1, int position2, int position3, int newpro_flag, int prosales_flag,
                                int prosale_flag, string name, string warranty, string make_in, float price,
                                int sale, string inf_pro, string int_pro)
        {
            try
            {
                int i = DAL.ProductInsert(id_l1, id_l2, id_l3,
                                position1, position2, position3, newpro_flag, prosales_flag,
                                prosale_flag, name, warranty, make_in, price,
                                sale, inf_pro, int_pro);

                return i;
            }
            catch (Exception)
            {
                throw;
            }
        }

        //-----------------ProductUpdate with id--------------------------
        public int ProductUpdate(int id, int id_l1, int id_l2, int id_l3,
                                int position1, int position2, int position3, int newpro_flag, int prosales_flag,
                                int prosale_flag, string name, string warranty, string make_in, float price,
                                int sale, string inf_pro, string int_pro)
        {
            try
            {
                int i = DAL.ProductUpdate(id, id_l1, id_l2, id_l3,
                                position1, position2, position3, newpro_flag, prosales_flag,
                                prosale_flag, name, warranty, make_in, price,
                                sale, inf_pro, int_pro);

                return i;
            }
            catch (Exception)
            {
                throw;
            }
        }

        //-----------------ProductDelete with id--------------------------
        public int ProductDelete(int id)
        {
            try
            {
                int i = DAL.ProductDelete(id);

                return i;
            }
            catch (Exception)
            {
                throw;
            }
        }
    }
}
